package com.isky.visual.common;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.isky.visual.proj.entity.Project;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 分页参数的父类
 *
 * @author wenjs
 */
@Data
public class BasePageResult implements Serializable {
    private long total;
    private long pages;
    private Object records;

    public static <T> BasePageResult parse(IPage<T> result){
        BasePageResult bpr = new BasePageResult();
        bpr.total = result.getTotal();
        bpr.pages = result.getPages();
        bpr.records = result.getRecords();
        return bpr;
    }

    public static BasePageResult Null(){
        BasePageResult bpr = new BasePageResult();
        bpr.total = 0;
        bpr.pages = 0;
        bpr.records = null;
        return bpr;
    }

}
